package com.skeeey.aim.util;

import java.io.UnsupportedEncodingException;

import org.apache.poi.ss.usermodel.Row;

public class PosUtil {
	// 0-客户代码
	private int customerCode = -1;
	// 1-客户名称
	private int customerName = -1;
	// 2-原始提单号
	private int originalOrderNumber = -1;
	// 3-开单日期
	private int orderStartDate = -1;
	// 4-入库日期
	private int inStorageDate = -1;
	// 5-出库日期
	private int outStorageDate = -1;
	// 6-VIN码
	private int VINCode = -1;
	// 7-发动机号
	private int enginCode = -1;
	// 8-车辆代码
	private int autoCode = -1;
	// 9-车辆名称
	private int autoName = -1;
	// 10-颜色代码
	private int colorNumber = -1;
	// 11-颜色名称
	private int colorName = -1;
	// 12-车型年
	private int autoAge = -1;
	// 13-版本号
	private int version = -1;
	// 14-内饰
	private int innerOrnament = -1;
	// 15-内饰名
	private int innerOrnamentName = -1;
	// 16-选装包
	private int optionalPackageName = -1;
	// 17-状态名称
	private int status = -1;
	// 18-属性名称
	private int attributeName = -1;
	// 19-自制件
	private int flag = -1;
	// 20-存放地代码
	private int storageLocationCode = -1;
	// 21-存放地点
	private int storageLocation = -1;

	// 21-修改
	private int modified = -1;
	// 23-零售/Saving订单
	private int retailOrder = -1;
	// 24-零售时间
	private int retailTime = -1;
	// 27-是否装配
	private int isAssembled = -1;

	public PosUtil(Row row) throws UnsupportedEncodingException {
		if (row != null) {
			for (int ci = 0; ci < row.getLastCellNum() + 1; ci++) {
				String cellVal = AIMUtil.getValueFrom(row.getCell(ci));
				if (cellVal != null) {
					if ("客户代码".equals(cellVal))
						customerCode = ci;
					if ("客户名称".equals(cellVal) || "用户名称".equals(cellVal))
						customerName = ci;
					if ("原始提单号".equals(cellVal))
						originalOrderNumber = ci;
					if ("开单日期".equals(cellVal))
						orderStartDate = ci;
					if ("入库日期".equals(cellVal))
						inStorageDate = ci;
					if ("出库日期".equals(cellVal))
						outStorageDate = ci;
					if ("VIN码".equals(cellVal))
						VINCode = ci;
					if ("发动机号".equals(cellVal))
						enginCode = ci;
					if (("车辆代码".equals(cellVal)) || ("车辆".equals(cellVal)))
						autoCode = ci;
					if ("车辆名称".equals(cellVal))
						autoName = ci;
					if ("颜色代码".equals(cellVal))
						colorNumber = ci;
					if ("颜色名称".equals(cellVal) || "颜色".equals(cellVal))
						colorName = ci;
					if ("车型年".equals(cellVal))
						autoAge = ci;
					if ("版本号".equals(cellVal))
						version = ci;
					if ("内饰".equals(cellVal))
						innerOrnament = ci;
					if ("内饰名".equals(cellVal))
						innerOrnamentName = ci;
					if ("选装包".equals(cellVal))
						optionalPackageName = ci;
					if ("状态名称".equals(cellVal))
						status = ci;
					if ("属性名称".equals(cellVal))
						attributeName = ci;
					if ("自制件".equals(cellVal))
						flag = ci;
					if ("存放地代码".equals(cellVal))
						storageLocationCode = ci;
					if ("存放地点".equals(cellVal))
						storageLocation = ci;
				}
			}
		}
	}

	public int getCustomerCodeIndex() {
		return customerCode;
	}

	public int getCustomerNameIndex() {
		return customerName;
	}

	public int getOriginalOrderNumberIndex() {
		return originalOrderNumber;
	}

	public int getOrderStartDateIndex() {
		return orderStartDate;
	}

	public int getInStorageDateIndex() {
		return inStorageDate;
	}

	public int getOutStorageDateIndex() {
		return outStorageDate;
	}

	public int getVINCodeIndex() {
		return VINCode;
	}

	public int getEnginCodeIndex() {
		return enginCode;
	}

	public int getAutoCodeIndex() {
		return autoCode;
	}

	public int getAutoNameIndex() {
		return autoName;
	}

	public int getColorNumberIndex() {
		return colorNumber;
	}

	public int getColorNameIndex() {
		return colorName;
	}

	public int getAutoAgeIndex() {
		return autoAge;
	}

	public int getInnerOrnamentIndex() {
		return innerOrnament;
	}

	public int getInnerOrnamentNameIndex() {
		return innerOrnamentName;
	}

	public int getOptionalPackageNameIndex() {
		return optionalPackageName;
	}

	public int getStatusIndex() {
		return status;
	}

	public int getAttributeNameIndex() {
		return attributeName;
	}

	public int getFlagIndex() {
		return flag;
	}

	public int getStorageLocationCodeIndex() {
		return storageLocationCode;
	}

	public int getStorageLocationIndex() {
		return storageLocation;
	}

	public int getModifiedIndex() {
		return modified;
	}

	public int getRetailOrderIndex() {
		return retailOrder;
	}

	public int getRetailTimeIndex() {
		return retailTime;
	}

	public int getIsAssembledIndex() {
		return isAssembled;
	}

	public int getVersionIndex() {
		return version;
	}
}
